<template>
   <view id="box">
    <view id="logo">
        			<swiper :indicator-dots="true" indicator-color="#FFFFFF" indicator-active-color="#FF0000" autoplay :autoplay="true"
			 :interval="3000" :duration="1000" circular class="lbt" @click="sss">
				<swiper-item>
					<view class="swiper-item">
						<image src="http://101.37.175.158:8888/images/tu3.jpg" style="width: 100%;height: 460rpx;"></image>
					</view>
				</swiper-item>
				<swiper-item>
					<view class="swiper-item">
						<image src="http://101.37.175.158:8888/images/tu4.jpg"
						 style="width: 100%;height: 460rpx;"></image>
					</view>
				</swiper-item>
				<swiper-item>
					<view class="swiper-item">
						<image src="http://101.37.175.158:8888/images/tu2.jpg" style="width: 100%;height: 460rpx;"></image>
					</view>
				</swiper-item>
			</swiper>
    </view>
    <view id="box1">
        <view class="box1_left" @click="mdzq">
            <van-icon name="shop-o" size="40px"/>
            <h2>门店自取</h2>
            <view class="bt">下单免排队</view>
        </view>
        <view class="box1_right" @click="waimai">
            <van-icon name="logistics"  size="40px"/>
            <h2>外卖</h2>
            <view class="bt">无需接触 送喜到家</view>
        </view>
    </view>
    <view id="box2">
        <view class="box2_left" @click="bh">
            <view class="box2_1">
                <van-icon name="bag-o" size="30px"/>
                <view class="t">喜茶百货</view>
            </view>
            <view class="bt">灵感商品 敬请选购</view>
        </view>

        <view class="box2_right" @click="tc">
            <view class="box2_1">
                <van-icon name="friends-o" size="30px"/>
                <view class="t">企业团餐</view>               
            </view>

            <view class="bt">50份起订</view>
        </view>
    </view>

    <view id="box3">
        <view class="box3_left" @click="wdjf">
            <view class="jf">
                <view>我的积分</view>
                <view
                :data="priceAll"
                 style="margin-left:20rpx;">{{priceAll}}</view>
            </view>
            <view class="bt">可兑换喜茶券和丰富灵感周边</view>
        </view>
        <view class="box3_right" @click="wode">
            <van-icon name="qr" size="30px"/>
            <view class="bt">会员码</view>
        </view>
    </view>
   </view>
</template>
<script>
export default {
    name:'index',
    data(){
        
        return{
            price:0,
            Arr:[],
            priceAll:0,
        }
    },
    
onShow:function(){
            let arr = getApp().globalData.ddsendArr;
            this.Arr = arr;
            this.priceAll = 0;
            for (let i = 0; i < this.Arr.length; i++) {
                this.priceAll = this.Arr[i].goodsPrice + this.priceAll;
            }
},
    methods: {





            // let arr = getApp().globalData.ddsendArr;
            // let jfArr = getApp().globalData.jfArr;
            // this.jf = jfArr
            // this.Arr = arr;
            // this.price = 0;
            // if(arr = ""){
            //     console.log(123)
            // }else{
            //     for (let i = 0; i < this.Arr.length; i++) {
            //         this.price = this.Arr[i].goodsPrice + this.price;      
            //     }
            //      this.jf =this.jf + this.price 
            //     console.log(this.price)
                
            // }


            // console.log(getApp().globalData.ddsendArr.length)
            // console.log(getApp().globalData.ddsendArr[0].goodsPrice)
            // console.log(getApp().globalData.jfArr)
        bh(){
            console.log(123);
            uni.switchTab({
            url: '/pages/index/baihuo/baihuo'
            });
        },
        mdzq(){
            getApp().globalData.waimai=false
            console.log(getApp().globalData.waimai)
            uni.switchTab({
            url: '/pages/index/diandan/diandan'
            });
        },
        wode(){
            console.log(1234)
            uni.navigateTo({
                url:'/pages/index/huiyuan/huiyuan'
            })
        },         
        wdjf(){
            console.log(123)   
            uni.navigateTo({
                url:'/pages/index/index/wdjf'
            });
        },
            tc(){
            console.log(123)
            uni.navigateTo({
                url:'/pages/index/index/qytuancan'
            });
        },
        waimai(){
            getApp().globalData.waimai=true
            console.log(getApp().globalData.waimai)
            uni.switchTab({
            url: '/pages/index/diandan/diandan'
            });;
        },

        onLoad(){   
            // let arr = getApp().globalData.ddsendArr;
            // let jfArr = getApp().globalData.jfArr;
            // if(arr = []){
            //     jfArr = 0
            //     console.log(456)
            // }else{
            //     // jfArr = arr.
            //     console.log(123)
            //         this.jf = jfArr
            //         this.Arr = arr;
            //         this.price = 0;
            //         if(arr = ""){
            //             console.log(123)
            //         }else{
            //             for (let i = 0; i < this.Arr.length; i++) {
            //                 this.price = this.Arr[i].goodsPrice + this.price;      
            //             }
            //             this.jf =this.jf + this.price 
            //             console.log(this.price)
                        
            //     }

            // }


            // this.list.push({
            //     price:getApp().globalData.jfArr 
            // })
            // this. jf = getApp().globalData.jfArr 
            
            uni.request({
                url: 'http://101.37.175.158:8888/zl',
                data: {},
                method: 'GET',
                success: (res)=>{
                    console.log(res.data)
                },
            });
                uni.request({
                url: "http://101.37.175.158:8888/dd",
                success: res => {
                    console.log(res.data);

                }
            });
        }
    }
}
</script>>
<style scoped>
#box{
    position: relative;
    background-color: #F6F6F6;
    height: 1235rpx;
}
#logo{
    height: 430rpx;
    width: 100%;
    background-color: gainsboro;
}
#box1{
    display: flex;
    /* justify-content: space-around; */
    width: 100%;
    left: 35rpx;
    top: 10rpx;
    width: 90%;
    border-radius: 20rpx;
    height: 300rpx;
    position: relative;
    background-color: white;
    padding: 40rpx 0;
    
    box-shadow:2px 2px 5px rgb(199, 193, 193),
    -2px 2px 5px rgb(199, 193, 193);
}

.box1_left{
    width: 50%;
    padding-top: 35px ;
    text-align: center;
    border-right: 1rpx solid black;
    font-weight: bolder;
}
.box1_right{
    padding-top: 35px ;
    width: 50%;
    text-align: center;
    font-weight: bolder;
}
.bt{
    font-weight: 100;
    font-size: 20rpx;
}
#box2{
    display: flex;
    margin-top: 50rpx;
    justify-content: space-around;
}
#box2>view{
    width: 40%;
    text-align: center;
    border-radius: 20rpx;
    background-color: #EAEBEC;
    font-weight: bold;
    padding: 25rpx;
    font-size: 30rpx;
}
.box2_1{
    
    width: 100%;
    display: flex;
    margin-left: 50rpx;
}
.t{
    height: 50px;
        line-height: 55px;
}
#box3{
    padding-top: 60rpx;
    display: flex;
    width: 100%;
}
.box3_left{
    margin-left: 20rpx;
    width: 70%;
}
.box3_left>.bt{
    padding-top: 10rpx;
}
.jf{
    display: flex;
}
.box3_right{
    border-left: 1px solid black;
    padding-left: 60rpx;
}
	.lbt {
		height: 460rpx;
	}

</style>